def add_domain(domain):
    with open('C:\\myApp\\init_system\\shadowsocksr\\pac.txt','r') as f:
        pac = f.read() 
        
    # print(f"pac={pac}")
    pattern = f'''var rules = ['''
    p = pac.find(pattern)
    p += len(pattern)
    pac = pac[:p] + f'\n\t"{domain}",' + pac[p:]
    with open('C:\\myApp\\init_system\\shadowsocksr\\pac2.txt','w') as f:
        f.write(pac)
    

    
if __name__ == '__main__':
    add_domain('togo.com')